#include<stdio.h>
int main()
{
	int n = 0; int arr[20] = { 0 }; int arr1[20] = { 0 };
	while (scanf_s("%d", &n) != EOF)
	{
		int i = 0;
		for (i = 0; i < n; i++)
		{
			scanf_s("%d", &arr[i]);
		}
		int m = 0; int j = 0;
		scanf_s("%d", &m);
		for (i = 0; i < n; i++)
		{
			if (arr[i] != m)
			{
				arr1[j] = arr[i]; j++;
			}
		}
		for (i = 0; i < j; i++)
		{
			printf("%d ", arr1[i]);
		}
	}
	printf("\n");
	return 0;
}